<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%!
	Cookie cookies[] = null;
	String	email = null;
	String type = null;

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Welcome!</title>
</head>
<body>
	
	<%
		
		cookies = request.getCookies();
		if(cookies==null){
			%>
			<a href="login.jsp" target="_top">Login</a>?or have a look
			<%
		}else{
			for(int i =0;i<cookies.length;i++)
			{
				if(cookies[i].getName().equals("email")){
					email = cookies[i].getValue();
				}else if(cookies[i].getName().equals("type")){
					type = cookies[i].getValue();
				}
			}
			if(type == null){
				%>
				<a href="login.jsp" target="_top">Login</a>?or have a look
				<%
			}else if(type.equals("admin")){
				//go to manager
				%>
				<h4>Welcome! Administrator <%=email %></h4>
				<a href="adminDashboard.jsp" target="_top">Go to Administrator dashboard</a>
				<%
			}else if(type.equals("cus")){
				//goto user
				%>
				<h4>Welcome! Customer <%=email %></h4>
				<a href="userDashboard.jsp" target="_top">Go to user dashboard</a>
				<%
			}
		}
	%>
</body>
</html>